﻿
using Snowflake.Core;

namespace Common;
/// <summary>
/// 单例的雪花id帮助类
/// </summary>
public sealed class SnowflakeHelper
{
    private static readonly IdWorker _idWorker;
    private SnowflakeHelper(){}
    /// <summary>
    /// 静态的构造函数 只有在调用属性或者方法的时候 才执行一次  所有  可以保证是单例的
    /// </summary>
    static SnowflakeHelper()
    {
        _idWorker = new IdWorker(1, 1);
    }

    public static long GetId()
    {
       return _idWorker.NextId();
    }
}